Skip to main content

UML Final Node vs End Node

Both final nodes and end nodes are used to represent the termination points of an activity or a control flow, but they have different purposes and characteristics.

UML Final Node​

The UML final node is used to denote the end of a specific flow within an activity diagram or a state machine diagram. It indicates the successful completion or termination of that particular flow, but it doesn't necessarily mean the end of the entire activity or state machine.

Final nodes are often used within loops or conditional structures to indicate the end of a particular loop iteration or branch of execution.

After reaching a final node, the control flow ends for that specific path, but other paths or activities within the same diagram may continue execution.

UML End Node​

The UML end node, also known as an "activity final node," represents the termination of the entire activity or behavior within an activity diagram. It indicates the successful completion of the entire process or workflow.

End nodes are typically placed at the final point of the main control flow within an activity diagram, indicating the successful completion of the entire activity.

When a control flow reaches an end node, it signifies the end of the entire process or activity, and no further activities or flows should follow.

The key difference between a UML final node and a UML end node lies in their scope and purpose. A final node represents the termination of a specific path or flow within a diagram, while an end node represents the termination of the entire activity or behavior being modeled.

In the engine: forks and events​

The scope of an end node is the whole process, whichever thread reaches it: the main thread, a fork or an instance started by an event. When an end node is reached,

  • all other threads of the process are stopped where they stand (a thread that is still busy in an activity finishes it, but its action is ignored and it never gets to its next node),
  • join latches that threads are waiting at are discarded,
  • event subscriptions and the stored state of waiting threads (e.g. a chat that waits for the next message) are removed,
  • the finish listeners are told once.

A final node only ends the thread that reaches it. Resources are kept and the other threads carry on. This is what an event branch uses to wait for the next event: each event starts its own instance, which ends in a final node.

The validator reports two things that are probably not intended (as hints, they do not block a run):

  • a diagram with events that has no end node that can be reached: it runs until somebody stops it,
  • a join behind a fork that may never fire, because a decision in one of the branches has an arm that ends in a final node without reaching the join, while another arm reaches it.